/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.cara.dojo.bdd.nokiatest;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.matchers.JUnitMatchers;

import cuke4duke.annotation.I18n.EN.Given;
import cuke4duke.annotation.I18n.EN.Then;
import cuke4duke.annotation.I18n.EN.When;
import static org.junit.Assert.*;

public class ScoreSteps {

	
	Map<String, Integer> question1 = new HashMap<String, Integer>(){{
		put("No iterations", 1);
	}} ;
	Map<String, Integer> question2 = new HashMap<String, Integer>(){{
		put("Unit tested", 1);
	}} ;
	Map<String, Integer> question3 = new HashMap<String, Integer>(){{
		put("Poor user stories", 4);
	}} ;
	Map<String, Integer> question4 = new HashMap<String, Integer>(){{
		put("Product owner with clear product backlog estimated by team before sprint planning meeting", 5);
	}} ;
	Map<String, Integer> question5 = new HashMap<String, Integer>(){{
		put("Product Owner has burndown release with release date based on velocity", 7);
	}} ;
	Map<String, Integer> question6 = new HashMap<String, Integer>(){{
		put("Estimate error < 10 %", 10);
	}} ;
	Map<String, Integer> question7 = new HashMap<String, Integer>(){{
		put("Burndown chart only burns down when story is done", 5);
	}} ;
	Map<String, Integer> question8 = new HashMap<String, Integer>(){{
		put("No one disrupting team, only Scrum roles", 10);
	}} ;
	Map<String, Integer> question9 = new HashMap<String, Integer>(){{
		put("Team is in hyperproductive state", 10);
	}} ;
	private int score;
	private List<String> responses;
//	Q1 	: How long are your Iterations
//	Answers : 
//		No Iteration  						0
//		Iteration > 6 weeks 					1
//		Iteration duration is variable and < 6 weeks		2
//		Fixed Iteration of 6 weeks 				3
//		Fixed Iteration length of 5 weeks			4
//		Fixed iteration length of 4 weeks or less		10	
	@Given ("^les reponses \"([^\"]*)\", \"([^\"]*)\", \"([^\"]*)\", \"([^\"]*)\", \"([^\"]*)\", \"([^\"]*)\", \"([^\"]*)\", \"([^\"]*)\", \"([^\"]*)\"$")
	public void lesReponses(String reponse1, String reponse2, String reponse3, String reponse4, String reponse5, String
	reponse6, String reponse7, String reponse8, String reponse9) {
		//File responses = new File("E:/build/workspace/NokiaTestTemplate/src/spec/SpecScore.txt");
		
		responses = Arrays.asList(reponse1, reponse2, reponse3,reponse4,reponse5,reponse6,reponse7,reponse8,reponse9);
		
	}
	
	@When ("^je calcule le score total$")
	public void jeCalculeLeScoreTotal() {

		score = 0;
		int i=0;
		score = score + question1.get(responses.get(i++));
		score = score + question2.get(responses.get(i++));
		score = score + question3.get(responses.get(i++));
		score = score + question4.get(responses.get(i++));
		score = score + question5.get(responses.get(i++));
		score = score + question6.get(responses.get(i++));
		score = score + question7.get(responses.get(i++));
		score = score + question8.get(responses.get(i++));
		score = score + question9.get(responses.get(i++));
		
	}
	
	@Then ("^le score total devrait etre (\\d+)$")
	public void leScoreTotalDevraitEtre(int score) {
		assertEquals(score, this.score);
	}
//	
//	@Given ("^un score de base de 54$")
//	@Pending
//	public void unScoreDeBaseDe54() {
//	}
//	
//	@Given ("^les options \"([^\"]*)\", \"([^\"]*)\"$")
//	@Pending
//	public void lesOptionsInAddition(String reponse1, String reponse2) {
//	}
//	
//	@Then ("^le score total devrait etre \"([^\"]*)\"$")
//	@Pending
//	public void leScoreTotalDevraitEtre57_(String score1) {
//	}
//	
//	@Given ("^les options \"([^\"]*)\", \"([^\"]*)\"$")
//	@Pending
//	public void lesOptions(String reponse1, String reponse2) {
//	}
//	
//	@Then ("^le score total devrait etre \"([^\"]*)\"$")
//	@Pending
//	public void leScoreTotalDevraitEtre54_(String score1) {
//	}
//	
//	@Given ("^les options \"([^\"]*)\", \"([^\"]*)\"$")
//	@Pending
//	public void lesOptions1(String reponse1, String reponse2) {
//	}
//	
//	@Then ("^le score total devrait etre \"([^\"]*)\"$")
//	@Pending
//	public void leScoreTotalDevraitEtre56_(String score1) {
//	}
}
